package com.frame.base.ui.activity;

import android.widget.Button;
import android.widget.EditText;

import com.frame.base.R;
import com.frame.base.presenter.LoginPresenter;
import com.frame.base.presenter.LoginPresenterImp;
import com.frame.base.ui.view.LoginView;
import com.frame.base.utils.DialogUtil;
import com.frame.base.utils.ToastUtil;

import butterknife.BindView;
import butterknife.BindViews;
import butterknife.OnClick;

/**
 * Created by Administrator on 2017/10/27.
 */

public class LoginActivity extends BaseActivity implements LoginView {
    @BindView(R.id.et_username)
    EditText etUsername;
    @BindView(R.id.et_password)
    EditText etPassword;
    @BindView(R.id.btn_login)
    Button btnLogin;
    LoginPresenter presenter;

    @Override
    protected int getRes() {
        return R.layout.activity_login;
    }

    @Override
    protected void initViews() {
        presenter = new LoginPresenterImp(this);
    }

    @Override
    protected void initDatas() {

    }

    @Override
    public void show() {
        DialogUtil.showLoadingLabel(this);
    }

    @Override
    public void hide() {
        DialogUtil.dismissLoadingLabel();

    }

    @Override
    public void login(String s) {
        ToastUtil.showShort(this, s);
    }

    @OnClick(R.id.btn_login)
    void setOnclick() {
        presenter.login(etUsername.getText().toString().trim());
    }
}
